package com.zeus.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @author 冯扬龙
 * @date 2021/4/9 22:02
 */
@Controller
@RequestMapping("/echarts")
public class EcharsController {

    //设计问卷统计
    @RequestMapping("/design")
    public String browse() {
        return "echarts/design";
    }

    //投票统计
    @RequestMapping("/vote")
    public String vote() {
        return "echarts/vote";
    }

    //问卷发布统计
    @RequestMapping("/announce")
    public String issue() {
        return "echarts/announce";
    }

    //   发布统计   通过ajax传递数据实现实时数据更新，map里的key是图的横坐标，value是纵坐标，第一张char
    @RequestMapping("/ajax_design1")
    @ResponseBody
    public Map<String, Object> design_first() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("content", Arrays.asList("情感", "生活", "社会", "励志", "物质", "精神"));
        map.put("total", Arrays.asList(5, 6, 52, 10, 20, 3));
        return map;
    }

    //    发布统计第二张char
    @RequestMapping("/ajax_design2")
    @ResponseBody
    public Map<String, Object> design_second() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("persons", Arrays.asList("老人", "小孩", "青少年", "青壮年", "无业游民", "懵懂少年"));
        map.put("attitude", Arrays.asList("优秀", "良好", "还行", "不填", "勉勉强强"));
        return map;
    }

    //    发布统计第三张char
    @RequestMapping("/ajax_design3")
    @ResponseBody
    public Map<String, Object> design_third() {
        HashMap<String, Object> map = new HashMap<String, Object>();
//        map.put("reflect", Arrays.asList("老人","小孩","青少年","青壮年","无业游民","懵懂少年"));
        map.put("attitude", Arrays.asList("设计ok", "设计不行", "设计麻烦", "题目冗余", "勉勉强强"));
        return map;
    }

    //    发布统计第四张char
    @RequestMapping("/ajax_design4")
    @ResponseBody
    public Map<String, Object> design_fourth() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("content", Arrays.asList("暴力", "血腥", "色情", "科技", "梦幻", "绚丽"));
        map.put("total", Arrays.asList(5, 20, 36, 10, 10, 20));
        return map;
    }

    //    投票统计，vote.jsp,对应第三张表
    @RequestMapping("/ajax_vote3")
    @ResponseBody
    public Map<String, Object> vote_third() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("age", Arrays.asList("10~12", "20~30", "30~40", "40~50", "50~60", "70以上"));
        map.put("total", Arrays.asList(5, 6, 52, 10, 20, 3));
        return map;
    }

    // ，vote.jsp,对应第四张表
    @RequestMapping("/ajax_vote4")
    @ResponseBody
    public Map<String, Object> vote_fourth() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("school", Arrays.asList("农大", "财大", "交大", "清华", "复旦", "浙大"));
        map.put("attitude", Arrays.asList("满意", "不满意", "很烦", "特别烦", "很来火"));
        return map;
    }


    //    announce.jsp,第一张表
    @RequestMapping("/ajax_announce1")
    @ResponseBody
    public Map<String, Object> announce_first() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("situation", Arrays.asList("创建中", "已结束", "执行中", "存储中", "正在创建", "已过期"));
        map.put("total", Arrays.asList(5, 6, 52, 10, 20, 3));
        return map;
    }

    //    announce.jsp,第二张表
    @RequestMapping("/ajax_announce2")
    @ResponseBody
    public Map<String, Object> announce_second() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("month", Arrays.asList("一月", "二月", "三月", "四月", "五月", "六月"));
        return map;
    }

    //    announce.jsp,第三张表
    @RequestMapping("/ajax_announce3")
    @ResponseBody
    public Map<String, Object> announce_third() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("year", Arrays.asList("2016", "2015", "2014", "2017", "2020", "2018"));
        return map;
    }

    //    announce.jsp,第四张表
    @RequestMapping("/ajax_announce4")
    @ResponseBody
    public Map<String, Object> announce_fourth() {
        HashMap<String, Object> map = new HashMap<String, Object>();
        map.put("person", Arrays.asList("小红", "小蓝", "小白", "小紫", "小黑", "小青"));
        map.put("total", Arrays.asList(5, 6, 52, 10, 20, 3));
        return map;
    }
}
